package MailUtil;


import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

/**
 * 邮件服务器登录校验
 */
public class MailAuthenticator extends Authenticator {
    private String userName;
    private String password;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(userName,password);
    }

    public MailAuthenticator(String userName, String password) {
        this.userName = userName;
        this.password = password;
    }
}
